package com.weita.lightfood.model.dao;


import com.weita.lightfood.model.entity.Material;
import com.weita.lightfood.model.vo.material.AddDishMaterialVo;
import com.weita.lightfood.model.vo.material.MaterialAttributeVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author IT_Monster at 2019/03/31 13:27.
 * 食材dao
 */
@Mapper
@Repository
public interface MaterialDao {
    /**
     * 添加食材
     * @param material
     * @throws Exception
     */
    void addMaterial(Material material) throws Exception;

    /**
     * 获取菜谱食材
     * @param dishId
     * @return
     * @throws Exception
     */
    List<MaterialAttributeVo> getMaterial(@Param("dishId") int dishId) throws Exception;


    /**
     * 根据类别获取食材
     * @param type
     * @return
     * @throws Exception
     */
    List<AddDishMaterialVo> getTypeMaterial(int type) throws Exception;

    /**
     * 通过食材名获取食材id
     * @param name
     * @return
     * @throws Exception
     */
    int getIdByMaterialName(String name) throws Exception;

    /**
     * 获取所有精选食材名
     * @return
     * @throws Exception
     */
    List<String> getChoicenessMaterialName() throws Exception;

    /**
     * 根据食材名获取食材热量
     * @param MaterialName
     * @return
     * @throws Exception
     */
    int getCalorieByMaterialName(String MaterialName) throws Exception;

    /**
     * 通过精选食材名获取其对应普通食材id
     * @param name
     * @return
     * @throws Exception
     */
    List<Integer> getMaterialIdByChoicenessName(String name) throws Exception;
}
